﻿{include file="public/_meta"}

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 财务管理 <span class="c-gray en">&gt;</span> 充值列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c">
		<form action="" method="get">
	 	<span class="select-box inline">
		<select name="from" class="select">
          	<option value="0">来源分类</option>
          	{volist name="from" id="vo"}
          	<option value="{$key}" {if condition="$key eq $fromValue"}selected="selected"{/if}> {$vo}</option>
			{/volist}

        </select>
		</span> 日期范围：
			<input type="text" name="start_time" class="input-text" id="countTimestart" onfocus="selecttime(1)" value="{$start_time}" style="width:120px;" >
			-
			<input type="text" name="end_time" class="input-text" id="countTimesend" onfocus="selecttime(1)" value="{$end_time}"  style="width:120px;">

			<input type="text" name="qq" id="" value="{$qq}" placeholder=" 账号搜索" style="width:250px" class="input-text">
			<button name="" id="" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i></button>
		</form>
	</div>
	<table style="margin-top: 30px;" class="table table-border table-bordered table-bg table-hover table-sort table-responsive" >
		<thead>
		<tr>
			<th scope="col" colspan="12">充值列表 <span class='c-blue'>共{$total}条</span></th>
		</tr>
		<tr class="text-c">
			<th width="40">ID</th>
			<th width="150">订单</th>
			<th width="80">账号</th>
			<th width="150">昵称</th>
            <th width="70">真假用户</th>
			<th width="100">充值金额</th>
			<th width="80">来源</th>
			<th width="100">群号</th>
			<th width="80">交易方式</th>
			<!--<th width="80">确认者</th>-->
			<th width="150">时间</th>
			<th width="80">状态</th>
			<th width="150">操作</th>
		</tr>
		</thead>
		<tbody>

		{foreach $data as $key=>$vo }
		<tr class="text-c">
			<td>{$vo.id}</td>
			<td>{$vo.bill_no}</td>
			<td>{$vo.qq}</td>
			<td>{$vo.name}</td>
            <td>
                {if condition="$vo.trueth eq 1"}
                <span class="label label-secondary radius">真</span>
                {else}
                <span class="label label-danger radius">假</span>
                {/if}
            </td>
			<td>{$vo.money}</td>
			<td>{$vo.from|getFromName}</td>
			<td>{$vo.from_group}</td>
			<td>{$vo.payment_type|getPlatName}</td>
			<!--<td>{$vo.user_id}</td>-->
			<td>{$vo.create_time}</td>
			<td class="td-status">
				{if condition="$vo.status eq '待确认'"}
				<span class="label label-warning radius" type="button">待确认</span>
				{elseif condition="$vo.status eq '成功'"}

				<span class="label label-success radius" type="button">成功</span>
				{elseif condition="$vo.status eq '失败'"}

				<span class="label label-default radius" type="button">拒绝</span>
				{/if}
			</td>

			<td class="td-manage">
				{if condition="$vo.status eq '待确认'"}
				<span class="btn btn-success radius" type="button" data-uid="{$vo.member_id}" onclick="is_recharge(this,{$vo.id})" data-href="{:url('v/api/recharge')}">同意</span>&nbsp;
				<span class="btn btn-danger radius" onclick="refuse(this,{$vo.id})"  type="button" >拒绝</span>
				{/if}
			</td>
		</tr>
		{/foreach}




		</tbody>
	</table>

</div>
<div id="laypage"></div>

{include file="public/_footer"}
<style>
	.page .pagination li{display: inline;padidng-left:10px;}
	.pagination .active{color:red}
	.pagination .disabled{color:#888888}
</style>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="{$Think.config.__STATIC__}/hadmin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="{$Think.config.__STATIC__}/hadmin/lib/laypage/1.2/laypage.js"></script>

<script type="text/javascript">
    var url = '{:url("/recharge")}'+'?{$query}';
    //alert(url);
    laypage({
        cont: 'laypage', //容器。值支持id名、原生dom对象，jquery对象,
        pages: '{$pageTotal}', //总页数
        skin: '#5FB878', //皮肤
        curr :'{$curr}',
        jump: function(e, first){ //触发分页后的回调
            if(!first){ //一定要加此判断，否则初始时会无限刷新
                //alert(url+'?page='+e.curr);
                location.href = url+'&page='+e.curr;
            }
        }
    });

    function is_recharge(obj,id){
        url=$(obj).attr("data-href");
		money=$(obj).parent().parents().children("td").eq(5).html();
		qq=$(obj).parent().parents().children("td").eq(2).html();
		user_id=$(obj).attr("data-uid");
		from_group=$(obj).parent().parents().children("td").eq(7).html();
		console.log( $(obj).parents().prev().children("span")[0]);
		layer.confirm('确认一下?',function(index){
            $.ajax({
                type: 'POST',
                url: url,
				data:{'id':id,'money':parseInt(money),'member_id':user_id,'from_group':from_group,'qq':qq},
                dataType: 'json',
                success: function(data){
                    if(data.error_code==0){
                        layer.msg(data.msg,{icon:1,time:1000});
                        $(obj).parents().prev().children("span").eq(0).attr("class","label label-success radius");
                        $(obj).parents().prev().children("span").eq(0).html("成功");
                        $(obj).next().remove();
                        $(obj).remove();
					}else{
                        layer.msg(data.msg,{icon:1,time:1000});
					}

                },
                error:function(data) {
                    layer.msg(data.msg,{icon:1,time:1000});
                },
            });
        });
    }

    function refuse(obj,id){
        layer.confirm('确认一下?',function(index){
            $.ajax({
                type: 'POST',
                url: "{:url('v/api/refuse_recharge')}",
                data:{'id':id},
                dataType: 'json',
                success: function(data){
                    if(data.error_code==0){
                        layer.msg(data.msg,{icon:1,time:1000});
                        $(obj).parents().prev().children("span").eq(0).attr("class","label label-default radius");
                        $(obj).parents().prev().children("span").eq(0).html("拒绝");
                        $(obj).prev().remove();
                        $(obj).remove();
                    }else{
                        layer.msg(data.msg,{icon:1,time:1000});
                    }

                },
                error:function(data) {
                    layer.msg("网络错误！",{icon:1,time:1000});
                },
            });
        });
	}


</script>


